package org.qiuqiu.tools;

import java.io.IOException;
import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

/**
 * @author 杜秋野
 *
 */
public class SqlMapTool {
	static SqlMapClient sqlMap;
	static Reader reader;
	static String resource = "org/qiuqiu/ibatis/config/SqlMapConfig.xml";
	
	static{
		try {
//			System.out.println("系统准备就绪");
			reader = Resources.getResourceAsReader(resource);
//			System.out.println("加载配置文件成功");
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
//			System.out.println("读取配置文件成功");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static SqlMapClient getSqlMap(){
		
		return sqlMap;
	}
}
